<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D导航栏</title>
    <style>
        ul{
         width: 900px;
         height: 500px;
         margin:100px auto;
        }
        li{
            list-style: none ;
            width: 200px;
            height: 100px;
        }
        .box{
            width: 100%;
            height: 100%;
            position: relative;
            perspective: 500px;
            transition: all 2s;
        }
        .box:hover{
            transform: rotateX(90deg);
            /* 让子元素保持3D立体放入效果 */
            transform-style: preserve-3d;
        }
        .font,
        .back{
            width: 100%;
            height: 100%;
            text-align: center;
            line-height: 100px;
            color: #fff;
            
            position: absolute;
            top: 0;
            left: 0;
        }
        .font{
            background-color: pink;
            /* 使3D旋转的效果 放到X轴上旋转 所以要把粉色盒子 向前移动紫色盒子高度的一半*/
            transform: translateZ(50px);
            z-index: 1;
        }
        .back{
            background-color: purple;
            transform:translateY(50px) rotateX(-90deg);
            /* transform: rotateX(-80deg); */
        }
        /* .back:hover{
            transform: rotateX(-80deg);
        } */
    </style>
</head>
<body>
    <ul>
        <li>
            <div class="box">
                <div class="font">迎面春风</div>
                <div class="back">桃花开</div>
            </div>
        </li>
    </ul>
</body>
</html>